<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<?php $title = '服务项目'; ?>
<head>
	<meta charset="UTF-8">
	<title><?php echo ($title); ?></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<link rel="stylesheet" href="/Application/Home/View//Public/static/css/weui.min.css"/>
    <link rel="stylesheet" href="/Application/Home/View//Public/static/css/jquery-weui.min.css"/>
    <link rel="stylesheet" href="/Application/Home/View//Public/static/css/custom.css"/>
    <style type="text/css">
		body{
			background:#f1f1f1;
			color:#a3a3a3;
			font-family:"Microsoft YaHei";
		}
		.bd{
			padding:20px;
		}
        li{list-style: none;}
		p{
			font-size: 13px;
		}
		.weui-cell_select-before .weui-cell__hd:before{
			border-width: 0px 2px 2px 0;
			margin-top: -6px;
		}
		.weui-cell_select-before .weui-cell__hd:after{border:none;}
        .sstmb {
            padding-bottom: 60px;
        }
        .foot-ul{
			text-align:center;
			margin-top: 1rem;
			padding:10px;
			background: #22a9fe;
			opacity: 0.9;
		}
		.foot-ul a{
			color: #fff;
		}
		.foot-ul a img{
			max-width: 24px;
		}
		.pinglun{
			padding: 0 2px;
			background: #ff5959;
			border-radius: 50px;
			color: #fff;
			position: absolute;
			top:-6px;
			left:73px;
			font-size: 13px;
		}
		
		
		.weui-cell__bd p{
		color:#6b6969;
		}
        
	</style>
</head>

<body ontouchstart>

 <style>
   .serviceitem{
       -webkit-touch-callout:none;
        -webkit-user-select:none;
        -khtml-user-select:none;
        -moz-user-select:none;
        -ms-user-select:none;
        user-select:none;
}  
   }
 </style>
    <div class="container js_container">

    </div>

    
 <header class="demos-header head-title">
	<a class="back" href="<?php echo U('index/card_edit');?>">
      <img style="width:10px;" src="/Application/Home/View//Public/static/images/back.png">
	</a>
	  <span>项目编辑</span>
	<a class="home" href="<?php echo U('Card/index');?>&userid=<?php echo (session('userid')); ?>">  
	  <img src="/Application/Home/View//Public/static/images/home.png">
	</a>
    </header>
       
<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><div class="page">
   <div class="weui-panel weui-panel_access serviceitem" data-id="<?php echo ($data["id"]); ?>">
        <div class="weui-panel__bd ">
          <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
            <div class="weui-media-box__hd">
             <?php if($data["icon"] != ""): ?><img class="weui-media-box__thumb" src="./uploads<?php echo ($data["icon"]); ?>" alt="">
             <?php else: ?>             
             <img class="weui-media-box__thumb" src="/Application/Home/View//Public/static/images/default.png" alt=""><?php endif; ?>
            </div>
            <div class="weui-media-box__bd">
              <h4 class="weui-media-box__title"><?php echo ($data["title"]); ?></h4>
              <p class="weui-media-box__desc">
                 <?php echo ($data["content"]); ?>
              </p>
            </div>
          </a>
      </div>
</div><?php endforeach; endif; else: echo "" ;endif; ?>

<div style="margin:2rem auto;width:12rem;border-radius:20px;" class="demos-content-padded">
      <a href="<?php echo U('ServiceItem/add');?>" style="background:#22a9fe;" class="weui-btn weui-btn_primary" >添加服务项目</a>
      
	 </div>
    <script src="/Application/Home/View//Public/static/js/jquery-2.1.4.js"></script>
    <script src="/Application/Home/View//Public/static/js/jquery-weui.min.js"></script>
    <script src="/Application/Home/View//Public/static/js/fastclick.js"></script>
    <script src="/Application/Home/View//Public/static/layer/layer.js"></script>
    <script src="/Application/Home/View//Public/static/js/jquery.form.js"></script>
    <script>
      $(function() {
        FastClick.attach(document.body);
      });
    </script>
</body>
</html>

<script>
  var time = 0;
  $(function(){
      $(".serviceitem").on('click', function(){
          show_actionshett($(this).attr("data-id"));
      })
      /*
      $(".serviceitem").on('touchstart', function(e){
           e.stopPropagation();
           that = $(this);
           time = setTimeout(function(){
               show_actionshett(that.parent().index());
           }, 500);
      });
      
      $(".serviceitem").on('touchend', function(e){
           e.stopPropagation();
           clearTimeout(time)
      });
      */
  })
  
  function show_actionshett(index){
      var id = index;
      $.actions({
          actions: [{
            text: "编辑",
            onClick: function() {
                location.href='<?php echo U("ServiceItem/edit");?>&id='+id;
            }
          },{
            text: "删除",
            onClick: function() {
                $.confirm("确定删除服务项？", function(){
                    $.ajax({
                        url:'<?php echo U("ServiceItem/del_item");?>',
                        data:{"id":id},
                        type:"POST",
                        success:function(data){
                            if(data == 1){
                               $.toast('删除成功!');
                               location.reload();
                            }else{
                               $.toast('删除失败，请稍后重试!', 'forbidden');
                            }
                        }
                    })
                });
            }
          }]
        });
  }
</script>